<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>新闻详情面</title>		
		<meta http-equiv="Access-Control-Allow-Origin" content="">
		<meta http-equiv="content-security-policy">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />		
		<link href="mui/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="styles/public.css" />
		<script src="mui/js/mui.js"  type="text/javascript"  charset="UTF-8"></script>		
	</head>
	<body>
		<!-- 主页面容器 -->
		<div class="mui-inner-wrap">
			<!-- 主页面标题 -->
	 		<header class="mui-bar mui-bar-nav">
	 			<a class="mui-icon mui-icon-back mui-pull-left mui-action-back"></a>	 			
	 			<h1 class="mui-title">新闻详情页面</h1>
	 		</header>
	 		<!--描述：底部选项卡 -->
			<nav class="mui-bar mui-bar-tab" id="footer">				
				<a class="mui-tab-item mui-active" href="index.html" title="首页">
					<span class="mui-icon fico0"></span>
					<span class="mui-tab-label">首页</span>
				</a>
				<a class="mui-tab-item" href="list.html?categoryID=50" title="办事指南">
					<span class="mui-icon fico2"></span>
					<span class="mui-tab-label">办事指南</span>
				</a>
				<a class="mui-tab-item" href="qualityAqi.html">
					<span class="mui-icon fico3"></span>
					<span class="mui-tab-label">空气质量</span>
				</a>
				<a class="mui-tab-item" href="list.html?categoryID=60" title="行政概况">
					<span class="mui-icon fico4"></span>
					<span class="mui-tab-label">行政概况</span>
				</a>
			</nav>		
			<div class="mui-content">
				 <div id="newcontent" class="mui-scroll content-detail" >				 	
                    <div id="objTitle"></div>
                    <div id="objTime"></div>
					<div id="objContent"></div>
					<br /><br />
              </div>                               
			</div>
		</div> 	
		<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>	
		<script type="text/javascript" src="common.js" ></script>
		<script type="text/javascript" charset="UTF-8">		
			$(function () {				
			  	var xx = $.getUrlParam('id');	
			  	loadNews(xx);			  	 
			});
			
			mui.init({
				
			});
			
			//添加链接
			mui('#footer').on('tap','a',function(e){
				if(window.localStorage){
					localStorage.removeItem("title");//清除c的值
					localStorage.setItem("title",this.getAttribute('title'));
				}
				mui.openWindow({
					url: this.getAttribute('href'),
					id: 'list'
				});
			})
			
			//加载新闻
			function loadNews(id){				
				var url=Base_URL+"/SiteIndex/queryArticleByIdAPP.json?id="+id;				
				$.ajax({
               		type: "post",
               		url:url,            
               		data:{						
						id:id
					},
               		dataType:"jsonp",
               		scriptCharset: 'utf-8',
               		jsonp: "callback",
               		success: function(data){                  			
                    	if(data!=null){   
                    		$("#objTitle").html(data.title);
                    		var objTimeHtml=data.orgIdName+"&nbsp;&nbsp;&nbsp;&nbsp;"+new Date(data.modifyDate).pattern("yyyy-MM-dd")+"&nbsp;&nbsp;&nbsp;点击"+data.clicks+"次";
							$("#objTime").html(objTimeHtml);
							document.getElementById("objContent").innerHTML=data.contents;
							//给图片加上前缀
							$("#objContent img").each(function(){			  					
            					var currImg = $(this);   
            					
            					var ImgurlNew='';				    						
		    					if(currImg.attr('src')!='' && currImg.attr('src').indexOf('http')==-1){ //判断图片路径
		    						ImgurlNew=Img_URL+currImg.attr('src');
		    					}else{
		    						ImgurlNew=currImg.attr('src');
		    					}
		    					
            					currImg.attr("src",ImgurlNew);
            				});
            	
						}              
               		},
	                error:function(){ 	                	
						console.log("获取新闻出现异常");
	                }
            	});
            	
            	//$("#objContent img").attr('src',Img_URL+this.getAttribute('src'));
            	
            	         	
            
            
            
			}			
		</script>
		
	</body>
</html>
